Skip to content

Conversation

@Glought
Copy link
Contributor

@Glought Glought commented Nov 12, 2025

I have port over Cvar_Prefix.h from SoH.

While working on my other PR #1325 I saw inconsistency with the Cvar naming

Example
In BenMenu.cpp:

AddWidget(path, "Fix Console Crashes", WIDGET_CVAR_CHECKBOX)
        .CVar("gEnhancements.Fixes.ConsoleCrashes")
AddWidget(path, "Fix Ammo Count Color", WIDGET_CVAR_CHECKBOX)'
        .CVar("gFixes.FixAmmoCountEnvColor")'
AddWidget(path, "Popout Gfx Debugger", WIDGET_WINDOW_BUTTON)'
        .CVar("gOpenWindows.GfxDebugger")'
AddWidget(path, "Popout Hook Debugger", WIDGET_WINDOW_BUTTON)'
        .CVar("gWindows.HookDebugger")`

I thought I'll help by implementing how its done in SoH.

CVAR MACRO Prefix Notes
CVAR_RANDOMIZER "gRando." Added
CVAR_RANDOMIZER_ENHANCEMENT "gRando.Enhancement." (Future use)
CVAR_RANDOMIZER_SETTING "gRando.Setting." (Future use)
CVAR_COSMETIC "gCosmetics."
CVAR_AUDIO "gAudioEditor."
CVAR_CHEAT "gCheats."
CVAR_ENHANCEMENT "gEnhancements."
CVAR_SETTING "gSettings."
CVAR_WINDOW "gOpenWindows."
CVAR_TRACKER "gTrackers."
CVAR_TRACKER_ITEM "gTrackers.ItemTracker."
CVAR_TRACKER_CHECK "gTrackers.CheckTracker."
CVAR_TRACKER_ENTRANCE "gTracker.EntraceTracker." (Future use)
CVAR_TRACKER_TIMESPLITS "gTrackers.TimeSplitsTracker."
CVAR_DEVELOPER_TOOLS "gDeveloperTools."
CVAR_GENERAL "gGeneral." (Future use)
CVAR_REMOTE "gRemote." (Future use)
CVAR_REMOTE_CROWD_CONTROL "gRemote.CrowdControl." (Future use)
CVAR_REMOTE_SAIL "gRemote.Sail." (Future use)
CVAR_GAMEPLAY_STATS "gGameplayStats." (Future use)
CVAR_TIME_DISPLAY "gTimeDisplay." (Future use)
CVAR_INPUT_VIEWER "gInputViewer."

With this lines like
Before:

AddWidget(path, "Fix Console Crashes", WIDGET_CVAR_CHECKBOX)
        .CVar("gEnhancements.Fixes.ConsoleCrashes")
AddWidget(path, "Fix Ammo Count Color", WIDGET_CVAR_CHECKBOX)'
        .CVar("gFixes.FixAmmoCountEnvColor")

After

AddWidget(path, "Fix Console Crashes", WIDGET_CVAR_CHECKBOX)
        .CVar(CVAR_ENHANCEMENT("Fixes.ConsoleCrashes"))
AddWidget(path, "Fix Ammo Count Color", WIDGET_CVAR_CHECKBOX)'
        .CVar(CVAR_ENHANCEMENT("Fixes.FixAmmoCountEnvColor")'

Moved Cvars:

I have reorganized CVars

Cvar Cvar Macro Expansion
"ItemTracker" CVAR_TRACKER_ITEM(*) "gTracker.ItemTracker.*"
"gRando.CheckTracker" CVAR_TRACKER_CHECK(*) "gTracker.CheckTracker.*"
"gSettings.TimeSplits" CVAR_TRACKER_TIMESPLITS(*) "gTracker.TimeSplitsTracker.*"
"gMatchRefreshRate" CVAR_SETTING("Graphics.MatchRefreshRate") "gSettings.Graphics.gMatchRefreshRate"
"gInterpolationFPS" CVAR_SETTING("Graphics.InterpolationFPS") "gSettings.Graphics.InterpolationFPS"
"gNotifications" CVAR_SETTING("Notifications.*") "gSettings.Notifications.*"
"gSettings.AdvancedResolution" CVAR_SETTING("Graphics.AdvancedResolution.*") "gSettings.Graphics.AdvancedResolution.*"
"gDisplayOverlay" CVAR_SETTING("DisplayOverlay.*") "gSettings.DisplayOverlay.*"
"gEventLog" CVAR_DEVELOPER_TOOLS("EventLog.*") "gDeveloperTools.EventLog.*"
"gCollisionViewer" CVAR_DEVELOPER_TOOLS("CollisionViewer.*") "gDeveloperTools.CollisionViewer.*"
"gModes" CVAR_ENHANCEMENT("Modes.*") "gEnhancements.Modes.*"
"gFixes" CVAR_ENHANCEMENT("Fixes.*") "gEnhancements.Fixes.*"
"gWindows" gOpenWindows("*") "gOpenWindows.*"

Configuration Migration

To make this as seamless I have ported over ConfigUpdater from SoH.
I have set it up to Migrate the Cvars I moved.

Here is a "2ship2harkinian.json" file for testing it has everything enabled.
2ship2harkinian.json

Build Artifacts

@Glought Glought force-pushed the cvar_prefixes branch 2 times, most recently from 9995571 to 46f4802 Compare November 13, 2025 13:41
@Glought Glought changed the title Ported Cvar_Prefix.h and ConfigUpdater from SoH Port Cvar_Prefix.h and ConfigUpdater from SoH Nov 14, 2025
@Glought Glought force-pushed the cvar_prefixes branch 4 times, most recently from 45fedd6 to c3a10dc Compare November 27, 2025 22:06
Added "CVAR_PREFIX_GAMEPLAY_STATS" and "CVAR_PREFIX_TIME_DISPLAY" to
"2ship-cvars.cmake"
Added Include "Cvar_Prefixes.h"  to "AudioCollection.cpp" and
"AudioEditor.cpp"
Changed code that uses "gOpenWindows." to the "CVAR_WINDOW" macro.
 Removed "CVAR_PREFIX_RANDOMIZER_ENHANCEMENT" macro.
 Removed "CVAR_PREFIX_RANDOMIZER_SETTING" macro.
Added "CVAR_RANDOMIZER" macro to "cvar_prefixes.h"
 Kept "CVAR_RANDOMIZER_ENHANCEMENT" and "CVAR_RANDOMIZER_SETTING" macros
 for future use.
Changed code that uses "gRando." to the "CVAR_RANDOMIZER" macro.
Changed lines that used "CFG_TRACKER_ITEM" to the "CVAR_TRACKER_ITEM"
macro.
"CVAR_TRACKER_CHECK" macro in "CheckTracker.cpp".
"gWindows", and "ItemTracker"
Added "gTrackers" to "defaultsPresetJ" and "TagMap".
the "CVAR_SETTING("Graphics.AdvancedResolution.*") macro.
Cvar_Prefix macro
Added a Include guard to "cvar_prefixes.h"
Changed code that uses "CVAR_SETTING("TimeSplits.*)" macro to use the
"CVAR_TRACKER_TIMESPLITS" macro.
"CVAR_SETTING("Notifications.*)" macro
"CVAR_SETTING("DisplayOverlay.*)" macro.
@garrettjoecox
Copy link
Contributor

Hey @Glought thanks for the PR! Sorry for such a long delay on a response and to have left you updating this multiple times. As soon as this went up it sparked some discussion in internal channels but they kind of lingered for a while, and I've landed on wanting to hold off on bringing this pattern over to 2ship.

While there is an obvious benefit of enforcing the common cvar prefixes, it's not as large of a problem on 2ship as it ever was on SoH because of our more limited and careful placement of cvars, and the problem is slowly getting smaller on SoH even as they adapt some of the newer patterns. IMO it makes cvar usage a bit more clunky and my editor is constantly fighting it on SoH with these macros not evaluating correctly or whatever.

I want to revisit the entirety of CVars and config usage because there have been several pain points we've had to work through over the years, but that's a much bigger undertaking and beyond the scope of this PR.

Once again we appreciate the PR along with your others! But we're going to pass on this one for the time being.

@Glought
Copy link
Contributor Author

Glought commented Jan 17, 2026

Ty for letting me know your decision

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants